<div>
    <table id="referApprove" lay-filter="referApprove"></table>
</div>
<script>
    layui.use(['table','setter','util'], function(){
        var table = layui.table;
        var setter = layui.setter;
        var util = layui.util;

        console.log()
        //第一个实例
        table.render({
            elem: '#referApprove'
            ,id:'referApprove'
            ,url: serverPath.workflowPath + setter.workflowLinkPath + "task/getRefList?modelId=${modelId!}&type=1"
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'subject', title: '请求标题', sort: true, fixed: 'left',align: 'center',event: 'get',minWidth: 330, style: 'color:#1E9FFF;cursor:pointer'}
                ,{field: 'creator', title: '创建人', align: 'center'}
                ,{field: 'creatTime', title: '创建时间',  sort: true, align: 'center', templet: function (d) {
                        if (d.createTime== undefined) {
                            return "";
                        } else {
                            return util.toDateString(d.createTime.time, "yyyy-MM-dd HH:mm:ss");
                        }
                    }
                }
                ,{field: 'endTime', title: '结束时间', sort: true ,align: 'center', templet: function (d) {
                        if (d.endTime== undefined) {
                            return "";
                        } else {
                            return util.toDateString(d.endTime.time, "yyyy-MM-dd HH:mm:ss");
                        }
                    }
                }
            ]]
        });
        //监听行工具事件
        table.on('tool(referApprove)', function (obj) {
            var data = obj.data;
            var runId = data.runId;
            var procInstId = data.procInstId;
            if(obj.event== 'get'){
                window.open( setter.workflowLinkPath +'processRun/view/get?runId=' + runId + '&procInstId=' + procInstId);
            }
        });
    });
</script>